package com.ruoyi.web.controller.community;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.community.domain.EcFoods;
import com.ruoyi.community.domain.HelpInfo;
import com.ruoyi.community.mapper.HelpInfoMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/community/help")
public class HelpInfoController extends BaseController {
    @Autowired
    HelpInfoMapper helpInfoMapper;

    @GetMapping("/info/{communityId}")
    public HelpInfo getHelpInfoByCommunityId(@PathVariable("communityId") Integer communityId){
        return helpInfoMapper.selectByCommunityId(communityId);
    }

    @PutMapping("/info")
    public AjaxResult updateInfo(@RequestBody HelpInfo helpInfo) {
        return toAjax(helpInfoMapper.updateByPrimaryKey(helpInfo));
    }
}
